/*     */ package com.qmsk.business.task.schedulerecoderNew.controller;
/*     */ 
/*     */ import com.qmsk.business.task.schedulerecoderNew.dao.CumsdlRcdDao;
/*     */ import com.qmsk.session.UserSessionInfo;
/*     */ import com.utils.basic.MapUtils;
/*     */ import com.utils.gson.in.ParserDataSetJson;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"scheduleRec"})
/*     */ public class CumsdlRcdController
/*     */ {
/*  32 */   private static final Logger logger = Logger.getLogger(CumsdlRcdController.class);
/*     */ 
/*     */   @Autowired
/*     */   private CumsdlRcdDao dao;
/*     */ 
/*     */   @Transactional(rollbackFor={Exception.class})
/*     */   @RequestMapping(value={"edit/shopId/{shopId}/status"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void updateStatus(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/*  41 */     Long id = RequestUtils.getLong(request, "id");
/*  42 */     Integer status = RequestUtils.getInt(request, "status");
/*  43 */     String userName = UserSessionInfo.getUserNameOfRequest(request);
/*  44 */     Integer nResult = null;
/*     */     try
/*     */     {
/*  47 */       if (status.intValue() == 2) {
/*  48 */         nResult = Integer.valueOf(this.dao.updateCheckedOfIds(userName, id, status));
/*     */       }
/*     */ 
/*  51 */       if (status.intValue() == 3) {
/*  52 */         nResult = Integer.valueOf(this.dao.updateCheckedOfIds(userName, id, status));
/*     */       }
/*  54 */       if (nResult.intValue() > 0)
/*  55 */         DbConnection.commit();
/*     */       else {
/*  57 */         DbConnection.rollback();
/*     */       }
/*  59 */       ResponseUtils.setSqlResultResponse(nResult.intValue(), 
/*  60 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/*  61 */         response);
/*     */     } catch (Exception e) {
/*  63 */       DbConnection.rollback();
/*  64 */       logger.error(e);
/*  65 */       ResponseUtils.setErrorMsgResponse(
/*  66 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/*  67 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional(rollbackFor={Exception.class})
/*     */   @RequestMapping(value={"check/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void check(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */     throws SQLException
/*     */   {
/*  76 */     Long id = RequestUtils.getLong(request, "id");
/*  77 */     String userName = UserSessionInfo.getUserNameOfRequest(request);
/*  78 */     int nResult = 0;
/*     */     try {
/*  80 */       nResult = this.dao.updateCheckedOfIds(userName, id, Integer.valueOf(1));
/*     */ 
/*  82 */       if (nResult > 0)
/*  83 */         DbConnection.commit();
/*     */       else {
/*  85 */         DbConnection.rollback();
/*     */       }
/*  87 */       ResponseUtils.setSqlResultResponse(nResult, 
/*  88 */         RequestUtils.getSqlUpdateDataErrorMessage(request), 
/*  89 */         response);
/*     */     } catch (Exception e) {
/*  91 */       DbConnection.rollback();
/*  92 */       logger.error(e);
/*  93 */       ResponseUtils.setErrorMsgResponse(
/*  94 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/*  95 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/opt/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListParams(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 104 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/* 106 */       Map params = new HashMap();
/*     */ 
/* 108 */       MapUtils.addToMap(params, "status", 
/* 109 */         RequestUtils.getShort(request, "status"));
/* 110 */       MapUtils.addPercentToMap(params, "cumsdlMan", 
/* 111 */         RequestUtils.getString(request, "cumsdlMan"));
/* 112 */       MapUtils.addPercentToMap(params, "linkPhone", 
/* 113 */         RequestUtils.getString(request, "linkPhone"));
/* 114 */       MapUtils.addToMap(params, "shopId", shopId);
/* 115 */       MapUtils.addToMap(params, "id", RequestUtils.getLong(request, "id"));
/* 116 */       MapUtils.addPercentToMap(params, "orderContent", 
/* 117 */         RequestUtils.getString(request, "orderContent"));
/* 118 */       MapUtils.addToMap(params, "dtOrderStart", 
/* 119 */         RequestUtils.getDate(request, "dtOrderStart"));
/* 120 */       MapUtils.addToMap(params, "dtOrderEnd", 
/* 121 */         RequestUtils.getDate(request, "dtOrderEnd"));
/*     */ 
/* 123 */       GsonEbRst gsonEbRst = this.dao.getGsonOfShopId(params, nPageIdx, 
/* 124 */         nPageSize);
/* 125 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/* 127 */       logger.error(e);
/* 128 */       ResponseUtils.setErrorMsgResponse(
/* 129 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListShopId(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 138 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/* 140 */       Map params = new HashMap();
/* 141 */       MapUtils.addToMap(params, "shopId", shopId);
/*     */ 
/* 143 */       GsonEbRst gsonEbRst = this.dao.getGsonOfShopId(params, nPageIdx, 
/* 144 */         nPageSize);
/* 145 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/* 147 */       logger.error(e);
/* 148 */       ResponseUtils.setErrorMsgResponse(
/* 149 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"edit/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void edit(HttpServletRequest request, HttpServletResponse response) throws SQLException
/*     */   {
/* 156 */     String sData = RequestUtils.getStringOfData(request);
/*     */     try {
/* 158 */       int nResult = 0;
/* 159 */       ParserDataSetJson p = ParserDataSetJson.fromString(sData);
/* 160 */       if (p != null) {
/* 161 */         nResult = this.dao.applyUpdates(p);
/* 162 */         if (nResult > 0)
/* 163 */           DbConnection.commit();
/*     */         else {
/* 165 */           DbConnection.rollback();
/*     */         }
/*     */       }
/* 168 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 169 */         RequestUtils.getSqlUpdateErrorMessage(sData, request), 
/* 170 */         response);
/*     */     } catch (Exception e) {
/* 172 */       DbConnection.rollback();
/* 173 */       logger.error(e);
/* 174 */       ResponseUtils.setErrorMsgResponse(
/* 175 */         RequestUtils.getSqlUpdateErrorMessage(sData, request) + ":" + 
/* 176 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"insert/insertInfo"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insertInfo(HttpServletRequest request, HttpServletResponse response) throws SQLException
/*     */   {
/* 183 */     String sData = RequestUtils.getStringOfData(request);
/*     */     try {
/* 185 */       int nResult = 0;
/* 186 */       ParserDataSetJson p = ParserDataSetJson.fromString(sData);
/* 187 */       if (p != null) {
/* 188 */         nResult = this.dao.applyUpdates(p);
/* 189 */         if (nResult > 0)
/* 190 */           DbConnection.commit();
/*     */         else {
/* 192 */           DbConnection.rollback();
/*     */         }
/*     */       }
/* 195 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 196 */         RequestUtils.getSqlUpdateErrorMessage(sData, request), 
/* 197 */         response);
/*     */     } catch (Exception e) {
/* 199 */       DbConnection.rollback();
/* 200 */       logger.error(e);
/* 201 */       ResponseUtils.setErrorMsgResponse(
/* 202 */         RequestUtils.getSqlUpdateErrorMessage(sData, request) + ":" + 
/* 203 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.task.schedulerecoderNew.controller.CumsdlRcdController
 * JD-Core Version:    0.5.3
 */